package com.edu.study.base.stuCourseSutdentDetail.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.edu.study.base.stuCourseSutdentDetail.domain.StuCourseSutdentDetail;
import com.edu.study.base.stuCourseSutdentDetail.service.IStuCourseSutdentDetailService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 学员课程内容学习进度Controller
 * 
 * @author zw
 * @date 2021-06-30
 */
@RestController
@RequestMapping("/stuCourseSutdentDetail/stuCourseSutdentDetail")
public class StuCourseSutdentDetailController extends BaseController
{
    @Autowired
    private IStuCourseSutdentDetailService stuCourseSutdentDetailService;

    /**
     * 查询学员课程内容学习进度列表
     */
    @PreAuthorize("@ss.hasPermi('stuCourseSutdentDetail:stuCourseSutdentDetail:list')")
    @GetMapping("/list")
    public TableDataInfo list(StuCourseSutdentDetail stuCourseSutdentDetail)
    {
        startPage();
        List<StuCourseSutdentDetail> list = stuCourseSutdentDetailService.selectStuCourseSutdentDetailList(stuCourseSutdentDetail);
        return getDataTable(list);
    }

    /**
     * 导出学员课程内容学习进度列表
     */
    @PreAuthorize("@ss.hasPermi('stuCourseSutdentDetail:stuCourseSutdentDetail:export')")
    @Log(title = "学员课程内容学习进度", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(StuCourseSutdentDetail stuCourseSutdentDetail)
    {
        List<StuCourseSutdentDetail> list = stuCourseSutdentDetailService.selectStuCourseSutdentDetailList(stuCourseSutdentDetail);
        ExcelUtil<StuCourseSutdentDetail> util = new ExcelUtil<StuCourseSutdentDetail>(StuCourseSutdentDetail.class);
        return util.exportExcel(list, "stuCourseSutdentDetail");
    }

    /**
     * 获取学员课程内容学习进度详细信息
     */
    @PreAuthorize("@ss.hasPermi('stuCourseSutdentDetail:stuCourseSutdentDetail:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(stuCourseSutdentDetailService.selectStuCourseSutdentDetailById(id));
    }

    /**
     * 新增学员课程内容学习进度
     */
    @PreAuthorize("@ss.hasPermi('stuCourseSutdentDetail:stuCourseSutdentDetail:add')")
    @Log(title = "学员课程内容学习进度", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody StuCourseSutdentDetail stuCourseSutdentDetail)
    {
        return toAjax(stuCourseSutdentDetailService.insertStuCourseSutdentDetail(stuCourseSutdentDetail));
    }

    /**
     * 修改学员课程内容学习进度
     */
    @PreAuthorize("@ss.hasPermi('stuCourseSutdentDetail:stuCourseSutdentDetail:edit')")
    @Log(title = "学员课程内容学习进度", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody StuCourseSutdentDetail stuCourseSutdentDetail)
    {
        return toAjax(stuCourseSutdentDetailService.updateStuCourseSutdentDetail(stuCourseSutdentDetail));
    }

    /**
     * 删除学员课程内容学习进度
     */
    @PreAuthorize("@ss.hasPermi('stuCourseSutdentDetail:stuCourseSutdentDetail:remove')")
    @Log(title = "学员课程内容学习进度", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(stuCourseSutdentDetailService.deleteStuCourseSutdentDetailByIds(ids));
    }
}
